function set_cookie (name,value,days) {
        var argv = set_cookie.arguments;
        var argc = set_cookie.arguments.length;
        var expire = new Date();
        var path = (argc > 3) ? argv[3] : null;
        var domain = (argc > 4) ? argv[4] : null;

        expire.setTime(expire.getTime() + days*60*60*1000);

        str = name+"="+escape (value)+"; expires=" + expire.toGMTString()+ ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) ;
         document.cookie =str;
}


function get_cookie(name) {
        var arg = name + "=";
        var alen = arg.length;
        var clen = document.cookie.length;
        var i = 0;
        while (i < clen) {
                var j = i + alen;
                if (document.cookie.substring(i, j) == arg) {
                        offset=j;
                        var endstr = document.cookie.indexOf (";", offset);
                        if (endstr == -1)
                                endstr = document.cookie.length;
                        return unescape (document.cookie.substring(offset, endstr));
                }
                i = document.cookie.indexOf(" ", i) + 1;
                if (i == 0)
                        break;
        }
        return null;
}

function del_cookie(name) {
	if (get_cookie(name))
      {  var expdate = new Date ();
        expdate.setTime (expdate.getTime()-1);
        set_cookie (name, "", expdate)
	  }
}
